package org.linlinjava.litemall.db.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class DateUtil {
    public static DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");


    /**
     * 字符串转LocalDateTime
     * @return
     */
    public static LocalDateTime getLocalDataTime(String dateTime){
        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime time = LocalDateTime.now();
        //String localTime = df.format(time);
        LocalDateTime ldt = LocalDateTime.parse(dateTime,df);
       // System.out.println("LocalDateTime转成String类型的时间："+localTime);
//        System.out.println("String类型的时间转成LocalDateTime："+ldt);
        return ldt;
    }
}
